Skip to content

fix(metro): normalize remaining Windows path comparisons#4819

Draft
ryok90 wants to merge 3 commits into
mainfrom
fix/metro-windows-path-comparisons
Draft

fix(metro): normalize remaining Windows path comparisons#4819
ryok90 wants to merge 3 commits into
mainfrom
fix/metro-windows-path-comparisons

Conversation

@ryok90

@ryok90 ryok90 commented Jun 16, 2026

Copy link
Copy Markdown
Member

What

A small follow-up to #4453 (Windows path normalization for Metro federation). That PR normalized most path handling but left a few raw comparisons between Metro-provided paths and path.resolve-generated paths, which can disagree on separators on Windows.

This normalizes the remaining spots to POSIX before comparing:

  • resolver – the init-host and remote-entry originModulePath checks, plus the patched-HMRClient check
  • babel plugin – the blacklistedPaths / state.filename check

Why

On Windows, path.resolve produces \ separators while Metro can report the same file with /, so these equality checks could silently miss and skip the federation special-casing.

Impact

  • POSIX systems: no behavior change (nothing to rewrite).
  • Windows: comparisons match regardless of separator.

Validation

  • Added a resolver regression test that fails without the fix and passes with it.
  • metro-core tests pass locally.

Notes

Honest scoping: this is hardening that closes real gaps, not a verified end-to-end fix for the repro in #4440. The reporter is on a version that already includes #4453, and their own workaround patches point at Metro's exports map and a third-party rock-js ESM import() issue — neither of which lives here. Sharing this separately so the path-comparison gaps are closed regardless.

Refs #4440

#4453 normalized most Windows path handling but left three raw
comparisons between Metro-provided paths and `path.resolve`-generated
paths, which can disagree on separators on Windows:

- resolver: the init-host and remote-entry `originModulePath` checks
  and the patched-HMRClient check
- babel plugin: the `blacklistedPaths` / `state.filename` check

These now compare POSIX-normalized paths so they match correctly on
Windows. Behavior on POSIX systems is unchanged (no separators to
rewrite). Adds a resolver regression test that fails without the fix.

Refs #4440
@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 30466bb
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a310dac7fdd64000834d667
😎 Deploy Preview https://deploy-preview-4819--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 30466bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 46 packages
Name Type
@module-federation/metro Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/modern-js Patch
@module-federation/modern-js-v3 Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/esbuild Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/utilities Patch
remote5 Patch
remote6 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
website-new Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@30466bb

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@30466bb

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@30466bb

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@30466bb

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@30466bb

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@30466bb

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@30466bb

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@30466bb

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@30466bb

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@30466bb

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@30466bb

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@30466bb

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@30466bb

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@30466bb

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@30466bb

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@30466bb

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@30466bb

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@30466bb

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@30466bb

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@30466bb

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@30466bb

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@30466bb

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@30466bb

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@30466bb

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@30466bb

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@30466bb

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@30466bb

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@30466bb

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@30466bb

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@30466bb

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@30466bb

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@30466bb

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@30466bb

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@30466bb

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@30466bb

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@30466bb

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@30466bb

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@30466bb

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@30466bb

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@30466bb

commit: 30466bb

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

11 package(s) changed, 30 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/cli 26.3 kB no change 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/devtools 664.0 kB no change 4.0 kB no change
@module-federation/enhanced 809.2 kB no change 672 B no change
@module-federation/managers 69.8 kB no change 334 B no change
@module-federation/manifest 136.1 kB no change 182 B no change
@module-federation/metro 277.4 kB +218 B (+0.1%) 147 B no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/node 193.4 kB no change 217 B no change
@module-federation/storybook-addon 79.1 kB no change 100 B no change
@module-federation/utilities 110.6 kB no change 328 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/cli 2.3 kB -31 B (-1.3%) 2.3 kB -31 B (-1.3%)
@module-federation/core 1.1 kB -32 B (-2.9%) 1.0 kB -31 B (-2.9%)
@module-federation/devtools 30.2 kB -27 B (-0.1%) 30.2 kB -27 B (-0.1%)
@module-federation/enhanced 2.6 kB -44 B (-1.6%) 2.6 kB -44 B (-1.6%)
@module-federation/managers 2.4 kB -27 B (-1.1%) 2.4 kB -27 B (-1.1%)
@module-federation/manifest 6.1 kB -40 B (-0.6%) 6.1 kB -40 B (-0.6%)
@module-federation/metro 9.5 kB +3 B (+0.0%) 9.4 kB +4 B (+0.0%)
@module-federation/metro-plugin-rnc-cli 411 B -26 B (-5.9%) 411 B -26 B (-5.9%)
@module-federation/node 9.2 kB -28 B (-0.3%) 9.2 kB -28 B (-0.3%)
@module-federation/storybook-addon 1.9 kB -24 B (-1.2%) 1.7 kB -23 B (-1.3%)
@module-federation/utilities 2.6 kB -32 B (-1.2%) 2.6 kB -32 B (-1.2%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 21.4 kB -16 B (-0.1%) 22.5 kB -15 B (-0.1%) +1.1 kB +1 B

Total dist (raw): 6.81 MB (+218 B (+0.0%))
Total ESM gzip: 78.5 kB (no change)
Total web bundle (gzip): 207.1 kB (-308 B (-0.1%))
Total node bundle (gzip): 207.6 kB (-305 B (-0.1%))
Tracked ./bundler entry gzip: 556 B (no change)
Tracked ./bundler web bundle (gzip): 4.8 kB (no change)
Tracked ./bundler node bundle (gzip): 4.8 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant